﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace PhreeBlime_Text
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            DialogResult result = opendiag.ShowDialog();
            if (result == DialogResult.OK) // Test result.
            {
                string file = opendiag.FileName;
                try
                {
                    string text = File.ReadAllText(file);
                    richTextBox1.Text = text;
                }
                catch (IOException)
                {
                    MessageBox.Show("IO ERROR");
                }
            }
        }
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            savediag.Filter = "Text File |*.txt";
            savediag.Title = "Save a Text File";
            savediag.ShowDialog();
            System.IO.FileStream fs = (System.IO.FileStream)savediag.OpenFile();
            fs.Close();
            
        }
    }
}
